package com.nhtrinh.game;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

class HelpFragmentAdapter extends FragmentPagerAdapter {
    protected static String[] arrContent ;
    
    private int mCount;

    public HelpFragmentAdapter(FragmentManager fm, String[] arr) {
        super(fm);
        arrContent = arr;
        mCount = arrContent.length;
    }

    @Override
    public Fragment getItem(int position) {
        return HelpFragment.newInstance(arrContent[position % arrContent.length]);
    }

    @Override
    public int getCount() {
        return mCount;
    }

    @Override
    public CharSequence getPageTitle(int position) {
      return HelpFragmentAdapter.arrContent[position % arrContent.length];
    }


    public void setCount(int count) {
        if (count > 0 && count <= 10) {
            mCount = count;
            notifyDataSetChanged();
        }
    }
}